import 'react-native-gesture-handler';
import React, {useEffect} from 'react';
import {Dimensions, LogBox, StatusBar} from 'react-native';
import {Icon, ThemeProvider} from 'react-native-elements';
import {DefaultTheme, NavigationContainer} from '@react-navigation/native';
import {createStackNavigator, HeaderBackButton, TransitionPresets} from '@react-navigation/stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';

import LocaleContext, {useLocale} from './libs/locale';
import WalletContext, {useWallet} from './libs/wallet';
import {getBestNodeView, getTxInfo} from './libs/nodes';
import Assets from './screens/Assets';
import Scan from './screens/Scan';
import Send from './screens/Send';
import TxDetails from './screens/TxDetails';
import PreSend from './screens/PreSend';
import SendSelectAsset from './screens/SendSelectAsset';
import Receive from './screens/Receive';
import Txs from './screens/Txs';
import Pool from './screens/Pool';
import My from './screens/My';
import Guest from './screens/Guest';
import Register from './screens/Register';
import Import from './screens/Import';
import Security from './screens/Security';
import ModifyPassword from './screens/ModifyPassword';
import AboutPrivateKey from './screens/AboutPrivateKey';
import Privacy from './screens/Privacy';
import Export from './screens/Export';
import Language from './screens/Language';
import Nodes from './screens/Nodes';
import About from './screens/About';
import GetTokens from './screens/GetTokens';
import PoolOp from './screens/PoolOp'; //TODO 2021-03-09
import {constansts} from './libs/constansts';
import SmartXApp from "./screens/SmartXApp";
import RedEnvelope from "./screens/RedEnvelope";
import RedEnvelopeInfo from "./screens/RedEnvelopeInfo";
import RedEnvelopeList from "./screens/RedEnvelopeList";
import RedEnvelopeIndex from "./screens/RedEnvelopeIndex";
import WebBrowserInfo from "./screens/WebBrowserInfo";
import WebBrowserMessage from "./screens/WebBrowserMessage";
import SetMyInfo from "./screens/SetMyInfo";
import SetName from "./screens/SetName";
import TokenInfo from "./screens/TokenInfo";
import ChatList from "./screens/ChatList";
import ChatView from "./screens/ChatView";
import ChatQRcode from "./screens/ChatQRcode";
import ChatQRscan from "./screens/chatQRscan";
import SetParams from "./screens/ParamsSet";
import xxx from "./screens/xxx";
import ChatFirstSet from "./screens/chatFirstSet";
import ChatListTemp from "./screens/ChatListTemp";
import WebBrowserDM from "./screens/WebBrowserDM";
import ChatGroupStart from "./screens/ChatGroupStart";
import ChatGroupCreate from "./screens/ChatGroupCreate";
import ChatGroupView from "./screens/ChatGroupView";
import ChatGroupQRcode from "./screens/ChatGroupQRcode";
import ChatGroupMy from "./screens/ChatGroupMy";
import ChatGroupJoin from "./screens/ChatGroupJoin";
import ChatGroupQRscan from "./screens/ChatGroupQRscan";
import ChatGroupDetail from "./screens/ChatGroupDetail";
import ChatGroupRemark from "./screens/ChatGroupRemark";
import RedEnvelopeRepub from "./screens/RedEnvelopeRepub";
import {getTxs2, saveTXone} from "./libs/pendingTxs";
import {sleep} from "./libs/helpers";
import NFTContract from "./screens/NFTContract";
import NFTDetail from "./screens/NFTDetail";
import NFTAddContract from "./screens/NFTAddContract";
import NFTSend from "./screens/NFTSend";
import L2_Tabs from "./smartxL2/L2_Tabs";
import L2_WalletDetail from "./smartxL2/L2_WalletDetail";
import L2_Receive from "./smartxL2/L2_Receive";
import L2_AddNet from "./smartxL2/L2_AddNet";
import L2_ImportWay from "./smartxL2/L2_ImportWay";
import L2_ImportByKeyOrMnemonic from "./smartxL2/L2_ImportByKeyOrMnemonic";
import L2_Send_Way from "./smartxL2/L2_Send_Way";
import L2_transfer from "./smartxL2/L2_Transfer";
import L2_TxList from "./smartxL2/L2_TxList";
import L2_transferDetail from "./smartxL2/L2_TransferDetail";
import L2_GetToken from "./smartxL2/L2_GetToken";
import L2_CustomToken from "./smartxL2/L2_CustomToken";
import L2_AddCustomizeNet from "./smartxL2/L2_AddCustomizeNet";
import L2_PrivateKeyView from "./smartxL2/L2_PrivateKeyView";
import L2_MnemonicView from "./smartxL2/L2_MnemonicView";
import L2_CreateWalletWay from "./smartxL2/L2_CreateWalletWay";
import L2_CreateWalletFirst from "./smartxL2/L2_CreateWalletFirst";
import L2_CheckMnemonicView from "./smartxL2/L2_CheckMnemonicView";
import L2_HomeAssetView from "./smartxL2/L2_HomeAssetView";
import L2_ImportByKeystore from "./smartxL2/L2_ImportByKeystore";
import L2_KeystoreView from "./smartxL2/L2_KeystoreView";
import L2_SettingPayByFinger from "./smartxL2/L2_SettingPayByFinger";
import L2_NodeView from "./smartxL2/L2_NodeView";
import L2_AddressBookView from "./smartxL2/L2_AddressBookView";
import L2_AddressBookAddView from "./smartxL2/L2_AddressBookAddView";
import L2_AddressBookAddAddressView from "./smartxL2/L2_AddressBookAddAddressView";

const Stack = createStackNavigator();
const Tabs = createBottomTabNavigator();


const {width,height,scale} = Dimensions.get("window");
LogBox.ignoreLogs(['Setting a timer for a long period of time']);

const theme = {
    greyOutline: '#7259E0FF',
    Button: {
        buttonStyle: {
            width: 240,
            paddingTop: 12,
            paddingBottom: 12,
            borderRadius: 8,
        },
        containerStyle: {
            margin: 10,
        }
    },
};

const NavigationTheme = {
    ...DefaultTheme,
    colors: {
        ...DefaultTheme.colors,
        background: 'white',
    },
};

const App = () => {
    const [locale, setLang] = useLocale();
    const [load, wallet, setWallet]:any = useWallet();

    useEffect(() => {
        // setTimeout(getBalance,1000);
        setTimeout(() => {
        }, 1000,),
            [];
        return;
    }, []);//msdgw 2021-03-03 20:24 5000�ĳ�3000
    //5秒检查一次交易
    useEffect(()=>{
        let active = 1;//0 进行中 1没有进行中
        const checkTrans = async () => {
                try {
                    if (active == 0) {
                        console.log(active);
                        return;
                    }
                    console.log("---------checkTrans---------" + new Date().toLocaleString())
                    active = 0;
                    let txx = await getTxs2();
                    for (let index = 0; index < txx.length; index++) {
                        let tx = txx[index];
                        if(tx.height === 0)
                        {
                            continue;
                        }
                        //获取交易状态接口 //状态 -1网络问题 0丢失 1完成 2发送中 3失败 -2没有这个接口
                        let res = await getTxInfo(tx.hash);
                        if (res.height === 0) {
                            txx[index].height = 0;
                            await saveTXone(txx[index], "modify");
                        } else if (res.height > 0) {
                            await saveTXone(txx[index], "del");
                        } else if (res === false && (((new Date().getTime()) - tx.trantime) > (2 * 60 * 1000))) {
                            txx[index].height = -2;
                            await saveTXone(txx[index], "modify");
                        }
                    }
                }catch (e) {
                    console.log(e)
                }
                active=1;
                await sleep(5*1000)
                await checkTrans();
            }
            checkTrans();
    },[])
    //15秒获取一次最佳节点
    useEffect(()=>{
        const getBestNodeInterval = async () => {
            let node = await getBestNodeView();
            constansts.bestNode = node;
            console.log("---------getBestNodeInterval---------:"+ node +"   " + new Date().toLocaleString())
            await sleep(15*1000)
            await getBestNodeInterval();
        }
        getBestNodeInterval();
    },[])

    const Normal = () => (
        <>
            <StatusBar  barStyle='dark-content'  translucent={false} backgroundColor="#FAFBFDFF"/>
            <Tabs.Navigator  tabBarOptions={{activeTintColor: '#7460E3FF',style:{paddingBottom:8,paddingTop:5,height:53} }}>
                <Tabs.Screen name="Assets" component={Assets} options={{
                    tabBarLabel: locale?._('Tabs.assets'),
                    tabBarIcon: ({color}) => <Icon type='font-awesome' name='database' color={color}/>,
                }}/>
                <Tabs.Screen name="Pool" component={Pool} options={{
                    tabBarLabel: locale?._('Tabs.pool'),
                    tabBarIcon: ({color}) => <Icon type='font-awesome' name='cubes' color={color}/>,
                }}/>
                <Tabs.Screen name="SmartXApp" component={SmartXApp}  options={{
                    tabBarLabel: locale?._('Tabs.apps'),
                    tabBarIcon: ({color}) => <Icon type='font-awesome-5' name='compass' color={color}/>,
                }}/>
                <Tabs.Screen name="My" component={My} options={{
                    tabBarLabel: locale?._('Tabs.my'),
                    tabBarIcon: ({color}) => <Icon type='font-awesome-5' name='user' color={color} />,
                }}/>
            </Tabs.Navigator>
            {/*<View style={{marginBottom:200,backgroundColor:'white'}}></View>*/}
        </>
    );

    return (
        <>
            {
                (locale === null || !load) ? <></> :
                    <>
                        <ThemeProvider theme={theme}>
                            <LocaleContext.Provider value={locale}>
                                <WalletContext.Provider value={wallet}>
                                    <NavigationContainer theme={NavigationTheme}>
                                        <Stack.Navigator
                                            initialRouteName={wallet ? 'Normal' : 'Guest'}
                                            screenOptions={{
                                                headerTitleAlign: 'center',
                                                headerStyle: {backgroundColor: '#FAFBFDFF',height:0.05*height},
                                                headerTitleStyle: {fontWeight: 'normal',lineHeight:0.05*height,fontSize:18},
                                                ...TransitionPresets.SlideFromRightIOS
                                            }}
                                        >
                                            <Stack.Screen name="Scan" component={Scan}
                                                              options={{title: locale._('Assets.scanQrcode')}}/>
                                            <Stack.Screen name="Send" component={Send}
                                                          options={{title: locale._('Assets.send')}}/>
                                            <Stack.Screen name="PreSend" component={PreSend} options={{
                                                title: locale._('Assets.preSend'),
                                                headerTransparent: true
                                            }}/>
                                            <Stack.Screen name="SendSelectAsset" component={SendSelectAsset}
                                                          options={{title: locale._('Assets.send.selectAsset')}}/>
                                            <Stack.Screen name="Receive" component={Receive}
                                                          options={{title: locale._('Assets.receive')}}/>
                                            <Stack.Screen name="Txs" component={Txs} options={{
                                                title: locale._('Assets.txs'),
                                                headerTransparent: true
                                            }}/>
                                            <Stack.Screen name="TxDetails" component={TxDetails} options={{
                                                title: locale._('Assets.tx.title'),
                                            }} />
                                            <Stack.Screen name="Normal" component={Normal}
                                                          options={{headerShown: false}} />
                                            <Stack.Screen name="Security" options={{
                                                title: locale._('My.security'),
                                                headerTransparent: true
                                            }}>
                                                {props => <Security {...props} setWallet={setWallet}/>}
                                            </Stack.Screen>
                                            <Stack.Screen name="AboutPrivateKey" component={AboutPrivateKey}
                                                          options={{title: locale._('My.security.exportPrivateKey.title')}}/>
                                            <Stack.Screen name="ModifyPassword"
                                                          options={{title: locale._('My.security.modifyPassword')}}>
                                                {props => <ModifyPassword {...props} setWallet={setWallet}/>}
                                            </Stack.Screen>
                                            <Stack.Screen name="Export">
                                                {props => <Export {...props} setWallet={setWallet}/>}
                                            </Stack.Screen>
                                            <Stack.Screen name="Language" options={{title: locale._('My.language')}}>
                                                {props => <Language {...props} setLang={setLang}/>}
                                            </Stack.Screen>
                                            <Stack.Screen name="Nodes" component={Nodes}
                                                          options={{title: locale._('My.nodes')}}/>
                                            <Stack.Screen name="About" component={About}
                                                          options={{title: locale._('My.about')}}/>

                                            <Stack.Screen name='GetTokens' component={GetTokens}
                                                          options={{title: locale._("Tabs.HotAssets")}}/>


                                            <Stack.Screen name="Guest" component={Guest}
                                                          options={{headerShown: false}}/>
                                            <Stack.Screen name="Register" options={{headerShown: false}}>
                                                {props => <Register {...props} setWallet={setWallet}/>}
                                            </Stack.Screen>
                                            <Stack.Screen name="PoolOp" component={PoolOp}
                                                          options={{title: locale._('Pool.zyhy_all')}}/>{/***2021-03-09*/}
                                            <Stack.Screen name="Privacy" component={Privacy}
                                                          options={{title: locale._('Register.privacy')}}/>
                                            <Stack.Screen name="Import" options={{title: locale._('Guest.import')}}>
                                                {props => <Import {...props} setWallet={setWallet}/>}
                                            </Stack.Screen>
                                            <Stack.Screen name="Pool" component={Pool} options={{
                                                title: locale._('Tabs.pool')
                                            }}/>
                                            {/*<Stack.Screen name="SmartXApp" component={SmartXApp} options={{*/}
                                            {/*    title: "ETH代币映射",*/}
                                            {/*    headerTransparent: true,*/}
                                            {/*    headerTintColor:'white',*/}
                                            {/*    headerTitleStyle:{fontWeight:"normal"}*/}

                                            {/*}}/>*/}
                                            <Stack.Screen name="RedEnvelopeIndex" component={RedEnvelopeIndex} options={{
                                                title: locale._('title.RedEnvelope'),
                                                headerTransparent: true,
                                            }}/>
                                            <Stack.Screen name="RedEnvelope" component={RedEnvelope} options={{
                                                title: "",
                                                headerTransparent: true,
                                            }}/>
                                            <Stack.Screen name="RedEnvelopeInfo" component={RedEnvelopeInfo} options={{
                                                title: locale._('title.RedEnvelopeInfoTitle'),
                                                headerTransparent: true,
                                            }}/>
                                            <Stack.Screen name="RedEnvelopeList" component={RedEnvelopeList} options={{
                                                title: locale._('title.RedEnvelopeListTitle'),
                                                headerTransparent: true,
                                            }}/>
                                            <Stack.Screen name="WebBrowserInfo" component={WebBrowserInfo} options={{
                                                title: locale._('title.browser'),
                                            }}/>
                                            <Stack.Screen name="WebBrowserMessage" component={WebBrowserMessage} options={{
                                                title: locale._('My.about')
                                            }}/>
                                            <Stack.Screen name="WebBrowserDM" component={WebBrowserDM} options={{
                                                title: ""
                                            }}/>
                                            <Stack.Screen name="SetMyInfo" component={SetMyInfo} options={{
                                                title: locale._('SetMyInfo.Title')
                                            }}/>
                                            <Stack.Screen name="SetName" component={SetName} options={{
                                                title: locale._('SetName.Title'),
                                            }}/>
                                            <Stack.Screen name="TokenInfo" component={TokenInfo} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatList" component={ChatList} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatView" component={ChatView} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatQRcode" component={ChatQRcode} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatQRscan" component={ChatQRscan} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="SetParams" component={SetParams} options={{
                                                title: "",
                                                headerStyle:{
                                                    backgroundColor:"#F5F5F5"
                                                }
                                            }}/>
                                            <Stack.Screen name="xxx" component={xxx} options={{
                                                title: "xxx",
                                            }}/>
                                            <Stack.Screen name="ChatFirstSet" component={ChatFirstSet} options={{
                                                title:  locale._("MeChat_ChatList_Title"),
                                            }}/>
                                            <Stack.Screen name="ChatListTemp" component={ChatListTemp} options={{
                                                title:  locale._("MeChat_ChatList_Title"),
                                            }}/>
                                            <Stack.Screen name="ChatGroupStart" component={ChatGroupStart} options={{
                                            title: "",
                                             }}/>
                                            <Stack.Screen name="ChatGroupCreate" component={ChatGroupCreate} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatGroupView" component={ChatGroupView} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatGroupQRcode" component={ChatGroupQRcode} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatGroupMy" component={ChatGroupMy} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatGroupJoin" component={ChatGroupJoin} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatGroupQRscan" component={ChatGroupQRscan} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatGroupDetail" component={ChatGroupDetail} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="ChatGroupRemark" component={ChatGroupRemark} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="RedEnvelopeRepub" component={RedEnvelopeRepub} options={{
                                                title: "",
                                            }}/>
                                            <Stack.Screen name="NFTContract" component={NFTContract} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0//去除导航阴影
                                                },
                                            }}/>
                                            <Stack.Screen name="NFTDetail" component={NFTDetail} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0//去除导航阴影
                                                },
                                            }}/>
                                            <Stack.Screen name="NFTAddContract" component={NFTAddContract} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0//去除导航阴影
                                                },
                                                headerShown:false
                                            }}/>
                                            <Stack.Screen name="NFTSend" component={NFTSend} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0//去除导航阴影
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_Tabs" component={L2_Tabs} options={{
                                                title: "",
                                                headerShown: false
                                            }}/>
                                            <Stack.Screen name="L2_GetToken" component={L2_GetToken} options={{
                                                title: "",
                                                headerShown: false
                                            }}/>
                                            <Stack.Screen name="L2_WalletDetail" component={L2_WalletDetail} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_AddNet" component={L2_AddNet} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_ImportWay" component={L2_ImportWay} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_ImportByKeyOrMnemonic" component={L2_ImportByKeyOrMnemonic} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_ImportByKeystore" component={L2_ImportByKeystore} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_CreateWalletWay" component={L2_CreateWalletWay} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_CreateWalletFirst" component={L2_CreateWalletFirst} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_CheckMnemonicView" component={L2_CheckMnemonicView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_Send_Way" component={L2_Send_Way} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTransparent:true,
                                            }}/>
                                            <Stack.Screen name="L2_transferDetail" component={L2_transferDetail} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTransparent:true,
                                            }}/>
                                            <Stack.Screen name="L2_transfer" component={L2_transfer} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_TxList" component={L2_TxList} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_CustomToken" component={L2_CustomToken} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:1,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_AddCustomizeNet" component={L2_AddCustomizeNet} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:1,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_HomeAssetView" component={L2_HomeAssetView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:1,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_PrivateKeyView" component={L2_PrivateKeyView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                }
                                            }}/>
                                            <Stack.Screen name="L2_SettingPayByFinger" component={L2_SettingPayByFinger} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                    backgroundColor:"#f6f6f6"
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                }
                                            }}/>
                                            <Stack.Screen name="L2_NodeView" component={L2_NodeView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                    backgroundColor:"#f6f6f6"
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                }
                                            }}/>
                                            <Stack.Screen name="L2_MnemonicView" component={L2_MnemonicView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                }
                                            }}/>
                                            <Stack.Screen name="L2_KeystoreView" component={L2_KeystoreView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                }
                                            }}/>
                                            <Stack.Screen name="L2_AddressBookView" component={L2_AddressBookView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_AddressBookAddAddressView" component={L2_AddressBookAddAddressView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                },
                                            }}/>
                                            <Stack.Screen name="L2_AddressBookAddView" component={L2_AddressBookAddView} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                },
                                                headerTitleStyle:{
                                                    fontSize:16
                                                }
                                            }}/>
                                            <Stack.Screen name="L2_Receive" component={L2_Receive} options={{
                                                title: "",
                                                headerStyle:{
                                                    borderBottomWidth:0,
                                                    elevation:0,//去除导航阴影
                                                    height:50,
                                                    backgroundColor:"#1f83fd",
                                                },
                                                headerTitleStyle:{
                                                    color:"white",
                                                    fontSize:16,
                                                },
                                                headerLeft:(props)=>(
                                                    <HeaderBackButton
                                                        {...props}
                                                        tintColor='#fff'
                                                    />
                                                )
                                            }}/>
                                        </Stack.Navigator>
                                    </NavigationContainer>
                                </WalletContext.Provider>
                            </LocaleContext.Provider>
                        </ThemeProvider>
                    </>
            }

        </>
    );
};

export default App;
